<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCategoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('categories', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title')->comment('名称');
            $table->integer('sort')->default(1)->comment('排序');
            $table->integer('p_id')->default(0)->comment('父级ID');
            $table->integer('type')->default(1)->comment('分类类别 10:违章描述, 20:企业规章, 30:违章处罚, 40: 体系要素, 50: 内审类别 60: 整改建议');
            $table->json('extended_data')->nullable()->comment('扩展数据');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('categories');
    }
}
